jsx3.Class.defineClass(
        "tibco.admin.monitormanage.uicomponents.text.serviceOverviewInfo.ServiceOverviewInfo", //the full name of the class to create
        jsx3.gui.Block, //  extends
        null, // implements
        function (plugin) {
			var server = tibco.admin.Main.getServer();
        	//plugin.serviceInfoMetrics = ["name", "description",  "resourceType", "implType", "javaClassName", "jarFile", "namespace", "uddiIdentifier"];
        	plugin.serviceInfoMetrics = ["name", "description",  "implType", "namespace"];
        	
        	plugin.serviceInfoMetricDisplayNames = [
				server.getDynamicProperty("@MM@general@lblName"), 
				server.getDynamicProperty("@MM@general@lblDescription"),
                server.getDynamicProperty("@MM@general@lblImplementation"),
                server.getDynamicProperty("@MM@general@lblNamespace"),
                //server.getDynamicProperty("@MM@general@lblVersion"),
				//server.getDynamicProperty("@MM@general@lblResourceType"),
                //server.getDynamicProperty("@MM@general@lblJavaClassName"),
				//server.getDynamicProperty("@MM@general@lblJarFile"),
				//server.getDynamicProperty("@MM@general@lblUDDIIdentifier")
				];
        	//plugin.serviceInstanceInfoMetrics = ["name", "description", "version", "resourceType", "deployedDate", "deployedBy", "messagingServer", "wsdlUrl", "schemaUrl"];
        	  	plugin.serviceInstanceInfoMetrics = ["name", "description",  "implType", "namespace"];
            plugin.serviceInstanceInfoMetricDisplayNames = [
				server.getDynamicProperty("@MM@general@lblName"), 
				server.getDynamicProperty("@MM@general@lblDescription"),
                server.getDynamicProperty("@MM@general@lblImplementation"),
                server.getDynamicProperty("@MM@general@lblNamespace"),
               /* server.getDynamicProperty("@MM@general@lblVersion"),
				server.getDynamicProperty("@MM@general@lblResourceType"), 
				server.getDynamicProperty("@MM@general@lblDeployedDate"), 
				server.getDynamicProperty("@MM@general@lblDeployedBy"), 
				server.getDynamicProperty("@MM@general@lblMessagingServer"), 
				server.getDynamicProperty("@MM@general@lblWsdlUrl"), 
				server.getDynamicProperty("@MM@general@lblSchemaURL")
			*/
                    ];
        	
        	plugin.prototype.isServiceInstance;
        
            plugin.prototype.init = function() {
                this.jsxsuper();
            }
            
            plugin.prototype.getNamespace = function() {
               return "tibco.admin";
            }
            
            plugin.prototype.setUpComponent = function(isServiceInstance) {
            	this.isServiceInstance = isServiceInstance;
            	var topic = tibco.admin.monitormanage.uicomponents.page.serviceView.ServiceView.serviceInfoCacheSubject;
            	
            	if(isServiceInstance)
            	{ topic = tibco.admin.monitormanage.uicomponents.page.serviceView.ServiceView.serviceInstanceInfoCacheSubject; }
            	tibco.admin.monitormanage.general.PageBusUtils.subscribe(topic, this.handleDisplayScreen, this);
            }
            
            plugin.prototype.handleDisplayScreen = function(subject, message, infoObj) {
            	infoObj.loadInfo(infoObj);
            }
            
            plugin.prototype.loadInfo = function(overviewInfoObj) {
           		var cacheId = tibco.admin.monitormanage.uicomponents.page.serviceView.ServiceView.serviceInfoCacheId;
           		var infoMetrics = plugin.serviceInfoMetrics;
           		var infoMetricDisplayNames = plugin.serviceInfoMetricDisplayNames;
           		if(overviewInfoObj.isServiceInstance)
           		{ 
           			cacheId = tibco.admin.monitormanage.uicomponents.page.serviceView.ServiceView.serviceInstanceInfoCacheId; 
           			infoMetrics = plugin.serviceInstanceInfoMetrics;
           			infoMetricDisplayNames = plugin.serviceInstanceInfoMetricDisplayNames;
           		}
            	
            	overviewInfoObj.removeChildren();	
           		var serviceInfoDoc = tibco.admin.Main.getServer().Cache.getDocument(cacheId);
       		 	if(serviceInfoDoc)
       		 	{
          			var record = serviceInfoDoc.getFirstChild();
       				for(j = 0; j < infoMetrics.length; j++)
	       	   		{
	       	   			var field = tibco.admin.Main.loadUIResource(overviewInfoObj, overviewInfoObj.getNamespace(), "tibco/admin/monitormanage/uicomponents/text/generalComponents/metricField.xml", false);
	       	   			var metricLabel = field.getDescendantOfName("metricLabel");
						metricLabel.setName(metricLabel.getName() + "_" + infoMetrics[j]);
	       	   			var valueLabel = field.getDescendantOfName("valueLabel");
						valueLabel.setName(valueLabel.getName() + "_" + infoMetrics[j]);
	       				metricLabel.setText(infoMetricDisplayNames[j]);
	       				valueLabel.setText(record.getAttribute(infoMetrics[j]));
	           		}
	       		 	overviewInfoObj.repaint();
	            }
            }

        });